package oop2;

import java.util.Scanner;

/**
 * @author oldliu
 * @since 1.0
 */
public class BanjiOperate {
    public static void main(String[] args) {
        Banji b=new Banji();
        b.name="java82";
        b.dirName="老刘";
        Scanner in=new Scanner(System.in);
        int choice=0;
        while (true){
            System.out.println("1:加新生，2:查看班级信息，3：找人,4:按照范围查找,5:改名字，9：退出");
            choice=in.nextInt();
            if(choice==1){
                System.out.print("请输入新生的名字：");
                String newStu=in.next();
                b.addNewStu(newStu);
                //b.addNewStu(in.next());
            }else if(choice==2){
                b.showClsInfo();
            }else if(choice==3){
                System.out.print("找谁：");
                String sname=in.next();
                boolean isIN = b.search(sname);
                System.out.println(isIN?"在":"不在");
            }else if(choice==4){
                System.out.print("找谁：");
                String sname=in.next();
                System.out.print("请输入起止范围：");
                int s=in.nextInt();
                int e=in.nextInt();
                boolean isIN =b.search2(s,e,sname);
                if(isIN){
                    System.out.println("在此范围内找到此人");
                }else{
                    System.out.println("在此范围内没找到此人");
                }
            }else if(choice==5){
                System.out.print("找谁：");
                String old=in.next();
                System.out.print("请输入新名字：");
                String newName=in.next();
                boolean m=b.modify(old,newName);
                System.out.println("修改的结果是："+m);
            }else if(choice==9){
                break;
            }
        }
    }
}
